<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Client_test extends CI_Controller {

	function __construct()
	{
		parent::__construct();
		$this->load->library("soap");
		$this->load->helper('url');
	}
	public function index()
	{
		$wsdl= 'http://localhost/appstore8x/index.php/ws/server8x?wsdl'; 
		
		$client=new nusoap_client($wsdl, array('wsdl')); 
		$client->soap_defencoding = "UTF-8"; 
		$param=array('commandcode' => 'ACC',  //EX: WF, WORLD
		    		'serviceid' => '8249', // Số dịch vụ (6x76)
		    		'userid'=> '84902171891', //84902171891
		    		'message'=> 'ACC pass', //ACC pass,KD nje
		    		'requestid'=> strval(rand(100000,9999999)),//ID MO: randomcode: 298963647
		    		'username'=> 'south', //authentication
		    		'password'=> 'south.123!@#'); 
		$result = $client->call('receiveMO', $param);
		if ($client->fault) {
		    echo '<h2>Fault</h2><pre>';
		    print_r($result);
		    echo '</pre>';
		} else {
			// Check for errors
		    $err = $client->getError();
		    if ($err) {
		        // Display the error
		        echo '<h2>Error</h2><pre>' . $err . '</pre>';
		    } else {
		        // Display the result
		        echo '<h2>Result</h2><pre>';
		        print_r($result);
		    echo '</pre>';
		    }
		}
		
		// Display the request and response
		echo '<h2>Request</h2>';
		echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
		echo '<h2>Response</h2>';
		echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
		// Display the debug messages
		echo '<h2>Debug</h2>';
		echo '<pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';

		//echo $client->getError();
		//$this->load->view('welcome_message');
	}
}
 